<!DOCTYPE html>
<html>
<head>

<script type="text/javascript" src="jquery-1.7.2.js"></script>
<script type="text/javascript">
 var jq = jQuery.noConflict();
// jq(document).ready(function{
// 	jq("div").delegate("p","click",function(){
// 		jq(this).slideToggle();
// 	});
// 	jq("button").click(function(){
// 		jq("<p>this is a new paragraph</p>").insertAfter("button");
// 	});
// });

$(document).ready(function(){
  $("div").delegate("p","click",function(){
    $(this).slideToggle();
  });
  $("button").click(function(){
    $("<p>This is a new paragraph.</p>").insertAfter("button");
  });
});

// jq(document).ready(
//   function(){
//  jq("p").bind(
// 		 {click:function(){jq(this).slideToggle();},
//  mouseover:function(){jq("body").css("background-color","#FF0000")}
//  });
//  jq("p").mouseout(function(){jq("body").css("background-color","#FFFFFF")});
//  });

</script>
</head>
<!-- <body> -->
<!-- <div> -->

<!-- <p>click this to slide toggle</p> -->
<!-- <button>add new paragraph</button> -->
<!-- <div> -->
<!-- </body> -->
<body>
<div style="background-color:yellow">
<p>This is a paragraph.</p>
<p>Click any p element to make it disappear. Including this one.</p>
<button>Insert a new p element after this button</button>
</div>
<p><b>Note:</b> By using the delegate() method, instead of live(), only the p elements inside the div element will be affected.</p>
</body>
</html>

</html>